<script>on mouseUpput card field yup into yoget isRunning(yo)put it&return into card field zozoend mouseUp</script>
</part>
<part>
<id>7</id>
<type>button</type>
<visible> <true /> </visible>
<reserved5> 0 </reserved5>
<reserved4> 0 </reserved4>
<reserved3> 0 </reserved3>
<reserved2> 0 </reserved2>
<reserved1> 0 </reserved1>
<enabled> <true /> </enabled>
<rect>
<left>391</left>
<top>131</top>
<right>445</right>
<bottom>183</bottom>
</rect>
<style>rectangle</style>
<showName> <true /> </showName>
<highlight> <false /> </highlight>
<autoHighlight> <true /> </autoHighlight>
<sharedHighlight> <true /> </sharedHighlight>
<family>0</family>
<titleWidth>0</titleWidth>
<icon>1004</icon>
<textAlign>center</textAlign>
<font>Chicago</font>
<textSize>12</textSize>
<textStyle>plain</textStyle>
<name>Source</name>
<script>on mouseUpgo nextend mouseUp</script>
</part>
<part>
<id>8</id>
<type>field</type>
<visible> <true /> </visible>
<dontWrap> <false /> </dontWrap>
<dontSearch> <false /> </dontSearch>
<sharedText> <false /> </sharedText>
<fixedLineHeight> <false /> </fixedLineHeight>
<autoTab> <false /> </autoTab>
<lockText> <false /> </lockText>
<rect>
<left>87</left>
<top>300</top>
<right>153</right>
<bottom>313</bottom>
</rect>
<style>rectangle</style>
<autoSelect> <false /> </autoSelect>
<showLines> <false /> </showLines>
<wideMargins> <false /> </wideMargins>
<multipleLines> <false /> </multipleLines>
<reservedFamily> 0 </reservedFamily>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>left</textAlign>
<font>Geneva</font>
<textSize>9</textSize>
<textStyle>bold</textStyle>
<textHeight>12</textHeight>
<name>yup</name>
<script></script>
</part>
<part>
<id>9</id>
<type>field</type>
<visible> <true /> </visible>
<dontWrap> <false /> </dontWrap>
<dontSearch> <false /> </dontSearch>
<sharedText> <false /> </sharedText>
<fixedLineHeight> <false /> </fixedLineHeight>
<autoTab> <false /> </autoTab>
<lockText> <false /> </lockText>
<rect>
<left>87</left>
<top>320</top>
<right>473</right>
<bottom>332</bottom>
</rect>
<style>rectangle</style>
<autoSelect> <false /> </autoSelect>
<showLines> <false /> </showLines>
<wideMargins> <false /> </wideMargins>
<multipleLines> <false /> </multipleLines>
<reservedFamily> 0 </reservedFamily>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>left</textAlign>
<font>Monaco</font>
<textSize>9</textSize>
<textStyle>plain</textStyle>
<textHeight>12</textHeight>
<name>zozo</name>
<script></script>
</part>
<part>
<id>11</id>
<type>field</type>
<visible> <true /> </visible>
<dontWrap> <false /> </dontWrap>
<dontSearch> <false /> </dontSearch>
<sharedText> <false /> </sharedText>
<fixedLineHeight> <false /> </fixedLineHeight>
<autoTab> <false /> </autoTab>
<lockText> <true /> </lockText>
<rect>
<left>53</left>
<top>10</top>
<right>446</right>
<bottom>62</bottom>
</rect>
<style>rectangle</style>
<autoSelect> <false /> </autoSelect>
<showLines> <false /> </showLines>
<wideMargins> <false /> </wideMargins>
<multipleLines> <false /> </multipleLines>
<reservedFamily> 0 </reservedFamily>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>left</textAlign>
<font>Times</font>
<textSize>48</textSize>
<textStyle>bold</textStyle>
<textHeight>64</textHeight>
<name>Nom</name>
<script></script>
</part>
<part>
<id>12</id>
<type>field</type>
<visible> <true /> </visible>
<dontWrap> <false /> </dontWrap>
<dontSearch> <false /> </dontSearch>
<sharedText> <false /> </sharedText>
<fixedLineHeight> <false /> </fixedLineHeight>
<autoTab> <false /> </autoTab>
<lockText> <true /> </lockText>
<rect>
<left>87</left>
<top>280</top>
<right>393</right>
<bottom>295</bottom>
</rect>
<style>rectangle</style>
<autoSelect> <false /> </autoSelect>
<showLines> <false /> </showLines>
<wideMargins> <false /> </wideMargins>
<multipleLines> <false /> </multipleLines>
<reservedFamily> 0 </reservedFamily>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>left</textAlign>
<font>Geneva</font>
<textSize>9</textSize>
<textStyle>plain</textStyle>
<textHeight>12</textHeight>
<name>yup</name>
<script></script>
</part>
<part>
<id>13</id>
<type>button</type>
<visible> <true /> </visible>
<reserved5> 0 </reserved5>
<reserved4> 0 </reserved4>
<reserved3> 0 </reserved3>
<reserved2> 0 </reserved2>
<reserved1> 0 </reserved1>
<enabled> <true /> </enabled>
<rect>
<left>54</left>
<top>127</top>
<right>107</right>
<bottom>179</bottom>
</rect>
<style>rectangle</style>
<showName> <true /> </showName>
<highlight> <false /> </highlight>
<autoHighlight> <true /> </autoHighlight>
<sharedHighlight> <true /> </sharedHighlight>
<family>0</family>
<titleWidth>0</titleWidth>
<icon>14767</icon>
<textAlign>center</textAlign>
<font>Chicago</font>
<textSize>12</textSize>
<textStyle>plain</textStyle>
<name>About</name>
<script>on mouseUpgo previousend mouseUp</script>
</part>
<content>
<layer>background</layer>
<id>4</id>
<text><span class="style2"> mettre dans le projet dans Think Pascal 4.02 :</span><span class="style1">Libraries:RSRCRuntime.LibInterface.libLibraries:HyperXLib.LibInterfaces:HyperXCmd.pInterfaces:Processes.pInterfaces:GestaltEqu.pIsRunning.p</span><span class="style2">Listing de IsRunning.p :</span><span class="style1">UNIT IsRunning;INTERFACE USES HyperXcmd, Processes, GestaltEqu; PROCEDURE main (paramPtr: XcmdPtr);IMPLEMENTATION CONST{ messages d'erreur et résultats } applRunning = 1; { l'application est en train de tourner } applNotRunning = 2; { l'application ne tourne pas } noGestalt = 3; { il n'y a pas Gestalt dans le système } errGestalt = 4; { gestalt a retourné une erreur } noProcess = 5; { Le process manager est absent } badSignature = 6; { la signature ne fait pas 4 caractères } helpNeeded = 7; { user asked for help } _Unimplemented = $A89F; { fichier Traps.p } FUNCTION askedForHelp (paramPtr: XcmdPtr; syntaxMsg, copyrightMsg: str255): BOOLEAN; VAR firstStr: str255; BEGIN askedForHelp := FALSE; IF paramPtr^.paramCount = 1 THEN BEGIN ZeroToPas(paramPtr, paramPtr^.params[1]^, firstStr); IF firstStr = '?' THEN BEGIN paramPtr^.returnValue := PasToZero(paramPtr, syntaxMsg); askedForHelp := TRUE; END ELSE IF firstStr = '!' THEN BEGIN paramPtr^.returnValue := PasToZero(paramPtr, copyrightMsg); askedForHelp := TRUE; END; END; END; FUNCTION NumToolboxTraps: INTEGER; CONST _InitGraf = $A86E; BEGIN IF NGetTrapAddress(_InitGraf, ToolTrap) = NGetTrapAddress($AA6E, ToolTrap) THEN NumToolboxTraps := $200 ELSE NumToolboxTraps := $400; END; FUNCTION GetTrapType (theTrap: INTEGER): TrapType; CONST TrapMask = $0800; BEGIN IF BAND(theTrap, trapMask) > 0 THEN GetTrapType := ToolTrap ELSE GetTrapType := OSTrap; END; FUNCTION trapAvailable (theTrap: INTEGER): BOOLEAN; VAR tType: TrapType; BEGIN tType := GetTrapType(theTrap); IF tType = ToolTrap THEN BEGIN theTrap := BAND(theTrap, $07FF); IF theTrap > NumToolBoxTraps THEN theTrap := _Unimplemented; END; TrapAvailable := NGetTrapAddress(theTrap, tType) <> NGetTrapAddress(_Unimplemented, ToolTrap); END; FUNCTION processAvail: OSErr; CONST _gestalt = $A1AD; VAR JoeLeBooleen: BOOLEAN; erreur: OSErr; myFeature: LONGINT; myBit: INTEGER; BEGIN processAvail := noErr; { first assume there's no error } JoeLeBooleen := TrapAvailable(_gestalt); IF JoeLeBooleen = FALSE THEN BEGIN processAvail := noGestalt; exit(processAvail); END;{ gestalt is available, try it } erreur := Gestalt(gestaltOSAttr, myFeature); IF erreur <> noErr THEN BEGIN processAvail := errGestalt; exit(processAvail); END;{ no error for Gestalt man ! let's try process manager } myBit := gestaltLaunchControl; IF BitTst(@myFeature, 31 - myBit) = FALSE THEN BEGIN processAvail := noProcess; exit(processAvail); END;{ everything's allright, even process mgr is here. we can use it's procedures } END; FUNCTION findAProcess (signature: OSType): boolean; VAR process: ProcessSerialNumber; infoRec: ProcessInfoRec; aFSSpecPtr: FSSpecPtr; BEGIN findAProcess := FALSE; { assume FALSE to begin } process.highLongOfPSN := 0; process.lowLongOfPSN := kNoProcess; { start from the beginning } infoRec.processInfoLength := sizeOf(ProcessInfoRec); infoRec.processName := StringPtr(NewPtr(32)); infoRec.processAppSpec := aFSSpecPtr; WHILE (getNextProcess(process) = noErr) DO BEGIN IF GetProcessInformation(process, infoRec) = noErr THEN BEGIN IF (infoRec.processType = Longint('APPL')) AND (infoRec.processSignature = signature) THEN { found a process } BEGIN findAProcess := TRUE; EXIT(findAProcess); END; END; END; {while } END; FUNCTION isProcessRunning (paramPtr: XcmdPtr): OSErr; VAR erreur: OSErr; tempStr: str255; signature: OSType; BEGIN IF askedForHelp(paramPtr, 'IsRunning( signature) where signature is 4 caps', 'IsRunning XFCN 1.0, March 15 1993, Pierre MATHIEU, for URA 1451') THEN BEGIN isProcessRunning := helpNeeded; exit(isProcessRunning); END;{ no help needed } erreur := processAvail; IF erreur <> noErr THEN BEGIN isProcessRunning := erreur; exit(isProcessRunning); END;{ les procedures du Process mgr sont ici, on peut faire le test } IF paramPtr^.paramCount > 0 THEN BEGIN ZeroToPas(paramPtr, paramPtr^.params[1]^, tempStr); IF (LENGTH(tempStr) <> 4) THEN BEGIN isProcessRunning := badSignature; exit(isProcessRunning); END;{ ce n'est pas une signature… sortir, sinon, la signature fait 4 caractères } signature := OSType(LONGINT(tempStr)); IF findAProcess(signature) THEN isProcessRunning := applRunning { l'application est en train de tourner } ELSE isProcessRunning := applNotRunning; { l'application ne tourne pas } END; END; PROCEDURE main; VAR erreur: OSErr; returnStr: str255; BEGIN erreur := isProcessRunning(ParamPtr); NumToString(INTEGER(erreur), returnStr); IF erreur <> helpNeeded THEN paramPtr^.returnValue := pasToZero(ParamPtr, returnStr); END;END.</span></text>
</content>
<content>
<layer>card</layer>
<id>8</id>
<text>WILD</text>
</content>
<content>
<layer>card</layer>
<id>9</id>
<text></text>
</content>
<content>
<layer>card</layer>
<id>11</id>
<text>IsRunning XFCN</text>
</content>
<content>
<layer>card</layer>
<id>12</id>
<text>Put a creator (or anything) in the field below, then click IsRunning</text>
</content>
<name></name>
<script></script>
</card>
card_4598.xml
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" >
<script>on mouseUpgo to card id 2885end mouseUp</script>
</part>
<part>
<id>2</id>
<type>field</type>
<visible> <true /> </visible>
<dontWrap> <false /> </dontWrap>
<dontSearch> <false /> </dontSearch>
<sharedText> <false /> </sharedText>
<fixedLineHeight> <false /> </fixedLineHeight>
<autoTab> <false /> </autoTab>
<lockText> <true /> </lockText>
<rect>
<left>2</left>
<top>10</top>
<right>395</right>
<bottom>62</bottom>
</rect>
<style>rectangle</style>
<autoSelect> <false /> </autoSelect>
<showLines> <false /> </showLines>
<wideMargins> <false /> </wideMargins>
<multipleLines> <false /> </multipleLines>
<reservedFamily> 0 </reservedFamily>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>left</textAlign>
<font>Times</font>
<textSize>48</textSize>
<textStyle>bold</textStyle>
<textHeight>64</textHeight>
<name>Nom</name>
<script></script>
</part>
<part>
<id>3</id>
<type>field</type>
<visible> <true /> </visible>
<dontWrap> <false /> </dontWrap>
<dontSearch> <false /> </dontSearch>
<sharedText> <false /> </sharedText>
<fixedLineHeight> <false /> </fixedLineHeight>
<autoTab> <false /> </autoTab>
<lockText> <false /> </lockText>
<rect>
<left>2</left>
<top>67</top>
<right>510</right>
<bottom>332</bottom>
</rect>
<style>scrolling</style>
<autoSelect> <false /> </autoSelect>
<showLines> <false /> </showLines>
<wideMargins> <false /> </wideMargins>
<multipleLines> <false /> </multipleLines>
<reservedFamily> 0 </reservedFamily>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>left</textAlign>
<font>Geneva</font>
<textSize>9</textSize>
<textStyle>plain</textStyle>
<textHeight>12</textHeight>
<name></name>
<script></script>
</part>
<content>
<layer>card</layer>
<id>2</id>
<text>Source</text>
</content>
<content>
<layer>card</layer>
<id>3</id>
<text><span class="style2">ontent of the Think Pascal 4.02 projet</span><span class="style1"> IsRunning.π</span><span class="style2"> :</span><span class="style1">Libraries:RSRCRuntime.LibInterface.libLibraries:HyperXLib.LibInterfaces:HyperXCmd.pInterfaces:Processes.pInterfaces:GestaltEqu.pIsRunning.pIsRunning.p </span><span class="style2">source :</span><span class="style1">UNIT IsRunning;INTERFACE USES HyperXcmd, Processes, GestaltEqu; PROCEDURE main (paramPtr: XcmdPtr);IMPLEMENTATION CONST{ messages d'erreur et résultats } applRunning = 1; { app is running } applNotRunning = 2; { app is not running } noGestalt = 3; { Gestalt not available } errGestalt = 4; { gestalt returns an error } noProcess = 5; { Process Manager not available } badSignature = 6; { signature = creator is not 4 caps long } helpNeeded = 7; { user asked for help } _Unimplemented = $A89F; { File Traps.p not included in the project } FUNCTION askedForHelp (paramPtr: XcmdPtr; syntaxMsg, copyrightMsg: str255): BOOLEAN; VAR firstStr: str255; BEGIN askedForHelp := FALSE; IF paramPtr^.paramCount = 1 THEN BEGIN ZeroToPas(paramPtr, paramPtr^.params[1]^, firstStr); IF firstStr = '?' THEN BEGIN paramPtr^.returnValue := PasToZero(paramPtr, syntaxMsg); askedForHelp := TRUE; END ELSE IF firstStr = '!' THEN BEGIN paramPtr^.returnValue := PasToZero(paramPtr, copyrightMsg); askedForHelp := TRUE; END; END; END; FUNCTION NumToolboxTraps: INTEGER; CONST _InitGraf = $A86E; BEGIN IF NGetTrapAddress(_InitGraf, ToolTrap) = NGetTrapAddress($AA6E, ToolTrap) THEN NumToolboxTraps := $200 ELSE NumToolboxTraps := $400; END;{ See Inside Macintosh VI } FUNCTION GetTrapType (theTrap: INTEGER): TrapType; CONST TrapMask = $0800; BEGIN IF BAND(theTrap, trapMask) > 0 THEN GetTrapType := ToolTrap ELSE GetTrapType := OSTrap; END;{ See Inside Macintosh VI } FUNCTION trapAvailable (theTrap: INTEGER): BOOLEAN; VAR tType: TrapType; BEGIN tType := GetTrapType(theTrap); IF tType = ToolTrap THEN BEGIN theTrap := BAND(theTrap, $07FF); IF theTrap > NumToolBoxTraps THEN theTrap := _Unimplemented; END; TrapAvailable := NGetTrapAddress(theTrap, tType) <> NGetTrapAddress(_Unimplemented, ToolTrap); END;{ See Inside Macintosh VI } FUNCTION processAvail: OSErr; CONST _gestalt = $A1AD; VAR JoeLeBooleen: BOOLEAN; erreur: OSErr; myFeature: LONGINT; myBit: INTEGER; BEGIN processAvail := noErr; { first assume there's no error } JoeLeBooleen := TrapAvailable(_gestalt); IF JoeLeBooleen = FALSE THEN BEGIN processAvail := noGestalt; exit(processAvail); END;{ gestalt is available, let's try it } erreur := Gestalt(gestaltOSAttr, myFeature); IF erreur <> noErr THEN BEGIN processAvail := errGestalt; exit(processAvail); END;{ no error for Gestalt man ! let's try the Process Manager } myBit := gestaltLaunchControl; IF BitTst(@myFeature, 31 - myBit) = FALSE THEN BEGIN processAvail := noProcess; exit(processAvail); END;{ everything's allright, even process mgr is here. we can use it's procedures } END; FUNCTION findAProcess (signature: OSType): boolean; VAR process: ProcessSerialNumber; infoRec: ProcessInfoRec; aFSSpecPtr: FSSpecPtr; BEGIN findAProcess := FALSE; { assume FALSE to begin } process.highLongOfPSN := 0; process.lowLongOfPSN := kNoProcess; { start from the beginning } infoRec.processInfoLength := sizeOf(ProcessInfoRec); infoRec.processName := StringPtr(NewPtr(32)); infoRec.processAppSpec := aFSSpecPtr; WHILE (getNextProcess(process) = noErr) DO BEGIN IF GetProcessInformation(process, infoRec) = noErr THEN BEGIN IF (infoRec.processType = Longint('APPL')) AND (infoRec.processSignature = signature) THEN{ found a process } BEGIN findAProcess := TRUE; EXIT(findAProcess); END; END; END; {while } END;{ See Inside Macintosh VI } FUNCTION isProcessRunning (paramPtr: XcmdPtr): OSErr; VAR erreur: OSErr; tempStr: str255; signature: OSType; BEGIN IF askedForHelp(paramPtr, 'IsRunning( signature) where signature is 4 caps', 'IsRunning XFCN 1.0, March 15 1993, Pierre MATHIEU, for URA 1451') THEN BEGIN isProcessRunning := helpNeeded; exit(isProcessRunning); END;{ no help needed } erreur := processAvail; IF erreur <> noErr THEN BEGIN isProcessRunning := erreur; exit(isProcessRunning); END;{ The Process Mgr procedures are available } IF paramPtr^.paramCount > 0 THEN BEGIN ZeroToPas(paramPtr, paramPtr^.params[1]^, tempStr); IF (LENGTH(tempStr) <> 4) THEN BEGIN isProcessRunning := badSignature; exit(isProcessRunning); END;{ This is no signature… exit, else, signature is 4 caps long } signature := OSType(LONGINT(tempStr)); IF findAProcess(signature) THEN isProcessRunning := applRunning { appl is running } ELSE isProcessRunning := applNotRunning; { appl is not running } END; END; PROCEDURE main; VAR erreur: OSErr; returnStr: str255; BEGIN erreur := isProcessRunning(ParamPtr); NumToString(INTEGER(erreur), returnStr); IF erreur <> helpNeeded THEN paramPtr^.returnValue := pasToZero(ParamPtr, returnStr); END;END.</span></text>
</content>
<name></name>
<script></script>
</card>
card_4874.xml
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" >
<script>on mouseUpgo to card id 2885end mouseUp</script>
</part>
<content>
<layer>card</layer>
<id>1</id>
<text><span class="style5"> </span><span class="style7">IsRunning 1.0</span><span class="style5"> by Pierre MATHIEU</span><span class="style6">WARNING</span><span class="style5"> IsRunning works on HC 2.x and system > 6.04, but it will return an accurate result (that is use the Process Manager) only with System > 7.0</span><span class="style6">DESCRIPTION</span><span class="style5"> IsRunning XFCN tells if the an application is running.</span><span class="style6">SYNTAX</span><span class="style5"> StrWidth("signature")</span><span class="style6">PARAMETERS</span><span class="style5"> signature is the creator of the application. It must be 4 caps long. Using "!" and "?" as parameter will return an online help (resp. copyright and syntax).</span><span class="style6">USING</span><span class="style5"> external returns : 1 : application is running 2 : application is not running 3 : Gestalt not available 4 : Gestalt error 5 : Process Manager not available 6 : signature is not 4 caps long</span></text>
</content>
<content>
<layer>card</layer>
<id>2</id>
<text><span class="style1">sRunning is freeware and can't be sold.Copy it freely as long as it is not modified.Send postcards, comments, bug reports to :Pierre MATHIEU1, Allée CarnotF-69 580 SATHONAY-CAMPFRANCEinternet : mathieu@biomserv.univ-lyon1.frIf you use this XFCN, please e-mail, or send me a postcard._____________________________________________________This XFCN was developed for the URA 1451. It is used in the ADE software, which is a </span><span class="style2">Program library for the Analysis of Environmental Data.</span><span class="style1">For information, please contact :</span><span class="style2">D. Chessel & S. Dolédec</span><span class="style1">Ecologie des eaux douces et des grands fleuves - URA CNRS 1451Univ. Lyon 1, 43 Bd du 11 Novembre 1918F-69622 Villeurbanne Cedex, FranceTel : 72 44 82 77 or 72 44 80 00 poste 39-45internet : chessel@biomserv.univ-lyon1.frinternet : sylvain@biomserv.univ-lyon1.frFax : 72 43 11 41</span></text>